Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Catch and guard against Integration errors #66

Merged
merged 1 commit into from
Apr 19, 2018

Conversation

f2prateek
Copy link
Contributor

To be able to record client side metrics, we need to modify analytics.js-integration to start propagate errors to analytics.js-core (https://paper.dropbox.com/doc/Analytics.js-Metrics-SDD-1hAD90lqGS4aZxHAHYPu7#:h2=analytics.js-integration) so that analytics.js-core can record metrics.

Currently analytics.js-integration is responsible for guarding when an integration method throws an error. Before changing the behaviour in analytics.js-integration, we need to make sure analytics.js-core guards against errors in integrations.

@f2prateek
Copy link
Contributor Author

Rough plan here is:

  • update a.js-core to catch integration errors (this PR)
  • update a.js-integration to propagate integration errors
  • build metrics client
  • integrate metrics client into analytics.js-core
  • update a.js-private/CDN etc.

@ucarion
Copy link

ucarion commented Apr 13, 2018

How come we're moving the catching of integration errors into analytics.js-core?

@f2prateek
Copy link
Contributor Author

f2prateek commented Apr 13, 2018

Mentioned this in the SDD (https://paper.dropbox.com/doc/Analytics.js-Metrics-SDD-1hAD90lqGS4aZxHAHYPu7?t=966581820045516849090263#:t=966581820045516849090263), but the TLDR is that current analytics.js-integration swallows errors, so to record metrics for those we would need to either:
a) pass the metrics client to a.js-integration
b) propagate the errors to a.js-core (which we're giving the metrics client anyway).

I went with b) as it limits the metrics instrumentation to one repo (a.js-core) which should be easier for both the initial implementation and long term maintenance.

@ucarion
Copy link

ucarion commented Apr 13, 2018

Cool, makes sense! Thanks for clarifying.

So this PR is so that we can next remove a corresponding try/catch from a.js-integration without having that crash all of ajs?

@ucarion
Copy link

ucarion commented Apr 13, 2018

I would approve this PR, but I don't think I know enough about these critical pieces to do so. So I'll defer to others who know more about A.js internals.

@f2prateek
Copy link
Contributor Author

So this PR is so that we can next remove a corresponding try/catch from a.js-integration without having that crash all of ajs?

Yep!

@f2prateek f2prateek requested a review from tsholmes April 13, 2018 22:37
f2prateek added a commit to segmentio/analytics.js-integration that referenced this pull request Apr 13, 2018
As part of adding client side metrics, we want to propagate errors to analytics.js-core so that it can capture them.

analytics.js-core has already been updated to capture errors when invoking integrations (segmentio/analytics.js-core#66).
To be able to record client side metrics, we need to modify analytics.js-integration to start propagate errors to analytics.js-core (https://paper.dropbox.com/doc/Analytics.js-Metrics-SDD-1hAD90lqGS4aZxHAHYPu7#:h2=analytics.js-integration) so that analytics.js-core can record metrics.

Currently analytics.js-integration is responsible for guarding when an integration method throws an error. Before changing the behaviour in analytics.js-integration, we need to make sure analytics.js-core guards against errors in integrations.
@f2prateek f2prateek force-pushed the catch-integration-errors branch from 3ab777c to 1109064 Compare April 13, 2018 23:41
f2prateek added a commit to segmentio/analytics.js-integration that referenced this pull request Apr 13, 2018
As part of adding client side metrics, we want to propagate errors to analytics.js-core so that it can capture them.

https://paper.dropbox.com/doc/Analytics.js-Metrics-SDD-1hAD90lqGS4aZxHAHYPu7#:h2=analytics.js-integration

analytics.js-core has already been updated to capture errors when invoking integrations (segmentio/analytics.js-core#66).
f2prateek added a commit to segmentio/analytics.js-integration that referenced this pull request Apr 13, 2018
As part of adding client side metrics, we want to propagate errors to analytics.js-core so that it can capture them.

https://paper.dropbox.com/doc/Analytics.js-Metrics-SDD-1hAD90lqGS4aZxHAHYPu7#:h2=analytics.js-integration

analytics.js-core has already been updated to capture errors when invoking integrations (segmentio/analytics.js-core#66).
f2prateek added a commit to segmentio/analytics.js-integration that referenced this pull request Apr 13, 2018
As part of adding client side metrics, we want to propagate errors to analytics.js-core so that it can capture them.

https://paper.dropbox.com/doc/Analytics.js-Metrics-SDD-1hAD90lqGS4aZxHAHYPu7#:h2=analytics.js-integration

analytics.js-core has already been updated to capture errors when invoking integrations (segmentio/analytics.js-core#66).
@f2prateek
Copy link
Contributor Author

FYI build failures are the same ones that have been failing even on master (e.g. https://circleci.com/gh/segmentio/analytics.js-core/329). I'll look into fixing that seperately, but keep that in mind!

Copy link
Contributor

@ccnixon ccnixon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@f2prateek f2prateek merged commit 221614c into master Apr 19, 2018
@f2prateek f2prateek deleted the catch-integration-errors branch April 19, 2018 17:55
f2prateek added a commit to segmentio/analytics.js-integration that referenced this pull request May 17, 2018
Same as #60 but for 2.x.

As part of adding client side metrics, we want to propagate errors to analytics.js-core so that it can capture them.

https://paper.dropbox.com/doc/Analytics.js-Metrics-SDD-1hAD90lqGS4aZxHAHYPu7#:h2=analytics.js-integration

analytics.js-core has already been updated to capture errors when invoking integrations (segmentio/analytics.js-core#66).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants